<template>
    <div style="padding:20px 10px;">
        <el-button size="mini" style="margin-bottom:10px;"  @click="$router.go(-1)"><i class="el-icon-back"></i>返回上一页</el-button>
        <admincentertb ref="httbRef" width="320" :btn-is-show="btnIsShow" :table-col="tabUserList" :table-data="tableUserData"/>
        <div style="text-align:right;margin-top:10px;">
            <el-pagination
            :current-page="page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="size"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            />
      </div>
    </div>
</template>

<script>
import request from '@/utils/request'
export default {
    data() {
        return{
            tableUserData:[],
            total: 0,
            size:10,
            page: 1,
            deployId:"",
            completeFormKey:"",
            tabUserList:[
                {
                    key: 'matterName',
                    title: '事项名称'
                },
                {
                    key: 'createTime',
                    title: '创建时间'
                }
            ],
            btnIsShow:{
                update:false,
                operate: true,
                getDetile: true
            }
        }  
    },
    created(){
        this.deployId = JSON.parse(this.$route.query.item).deployId
        this.completeFormKey = JSON.parse(this.$route.query.item).completeFormKey
        this.getUserList()
    },
    methods:{
        returnPage(){
            this.$router.go(-1)
        },
        getUserList(){
            request({
                url: '/ht-bpmn/complete/getCompleteBusinessList',
                method: 'post',
                data:{
                    pageSize:this.size,
                    pageIndex:this.page,
                    deployId:this.deployId
                }
            }).then(res => {
                if (res.code == 200) {
                    this.tableUserData = res.data.records
                    this.total = res.data.total
                }
            })

        },
        createPrelcObj(v){
            request({
                url: '/ht-bpmn/complete/getCompleteData?configId='+this.completeFormKey+'&processInstanceId='+JSON.parse(v).procinstId,
                method: 'get',
                data:{}
            }).then(res => {
                if (res.code == 200) {
                    this.$router.push({path:'/taskCen/noedit',query:{item:JSON.stringify(res.data)}})
                }
            })
        },
        handleSizeChange(v) {
            this.page = 1
            this.size = v
            this.getUserList()
        },
        handleCurrentChange(v) {
            this.page = v
            this.getUserList()
        },
    }
}
</script>


